//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_findwater.sqf"
#include "x_setup.sqf"

// get a random point inside a circle
// parameters:
// center position, radius of the circle
// example: _random_point = [position trigger1, 200] call FUNC(findWater);
private ["_rcenter", "_rradius", "_co", "_center_x", "_center_y", "_posee","_isFlat"];
PARAMS_2(_rcenter,_rradius);
__TRACE_2("","_rcenter","_rradius");
_center_x = _rcenter select 0;_center_y = _rcenter select 1;
_ret_val = [];
for "_co" from 0 to 150 do {
	_posee = [_center_x + (_rradius - (random (2 * _rradius))), _center_y + (_rradius - (random (2 * _rradius))), 0];
	if (surfaceIsWater _posee) exitWith {
		_ret_val = _posee;
	};
};
__TRACE_1("","_ret_val");
_ret_val